#include "GComponent.h"


namespace GEngine
{

	GComponent::GComponent()
	{
		Name = "Unnamed Component";
		Owner = NULL;
		Type = G_CT_CUSTOM;
		Active = true;
		MultiTasked = true;
	}

	GComponent::~GComponent()
	{

	}

	// owner is set by gameobject and this method is called
	void GComponent::OnAtach()
	{
	}

	// owner is reset by gameobject and this method is called
	void GComponent::OnDetach()
	{
	}

	GGameObject* GComponent::GetOwner() const
	{
		return Owner;
	}

	GComponentType GComponent::GetType() const
	{
		return Type;
	}

	void GComponent::SetActive(bool Value)
	{
		Active = Value;
	}

	bool GComponent::GetActive() const
	{
		return Active;
	}
	
	void GComponent::SetName(const char* CompName)
	{
		Name = CompName;
	}

	const char* GComponent::GetName() const
	{
		return Name.c_str();
	}

	bool GComponent::Update(float FrameTime)
	{
		return Active && (Owner != NULL);
	}

	bool GComponent::UpdateLate(float FrameTime)
	{
		return Active && (Owner != NULL);
	}

	bool GComponent::UpdateFixed(float FrameTime)
	{
		return Active && (Owner != NULL);
	}

}